package com.note.service.user;

import com.note.dao.user.userDao;
import com.note.dao.user.userDaoImpl;
import com.note.pojo.Users;

import java.sql.SQLException;

public class userServiceImpl implements userService{
    @Override
    public Users loginS(String username, String password) throws SQLException {
        userDao userDao = new userDaoImpl();
        Users users = userDao.loginDao(username, password);
        if(users!=null){
            return users;
        }else{
            return null;
        }
    }

    @Override
    public boolean updatePassword(String password, int id) throws SQLException {
        userDao u = new userDaoImpl();
        int i = u.updatePasswd(password, id);
        if (i>0){
            return true;
        }else{
            return false;
        }
    }

    @Override
    public boolean updateName(String nickname, int id) throws SQLException {
        userDao u = new userDaoImpl();
        int i = u.updateName(nickname, id);
        if (i>0){
            return true;
        }else{
            return false;
        }
    }
}
